package com.LeetCode;

public class _10_main {
	public static int maxArea(int[] height) {
		int capability = 0;
		int left = 0, right = height.length - 1;

		while (left < right) {
			int water = Math.min(height[left], height[right]) * (right - left);

			if (water > capability)
				capability = water;

			if (height[left] < height[right]) {
				++left;
			} else {
				--right;
			}
		}

		return capability;
	}

	public static void main(String[] args) {
		int[] height = { 1,2};
		System.out.println(maxArea(height));
	}
}
